<?php defined('_JEXEC') or die;
/**
 * @package pmapi
 * @copyright Copyright (c)2014 Enrico Fagnoni
 * @license GNU General Public License version 3, or later
 *
 * @since 1.0.0
 */
?>
<?=$this->getTurtlePrefixes()?> 
@prefix : <#> .

<?=$this->getDefaultMetadata()?>
<>  foaf:primaryTopic :ontology ;
    void:inDataset <<?=UriHelper::mkResourceURI()?>> ;
.

:ontology rdf:type owl:Ontology ;                       
       rdfs:label <?=ApiHelper::_T('COM_PMAPI')?> ;
       rdfs:comment <?=ApiHelper::_T('PMAPI_ONTOLOGY_DESCRIPTION')?> ;
.

# pmapi activities
:LinkedDataPublishing rdf:type owl:Class ;
    rdfs:label "Link Data Publishing"@en ;
    rdfs:subClassOf prov:Activity ;
    rdfs:comment "Automated Publishing of a Virtuemart dataset as Linked Data by com_pmdata"@en ;
.                    
:OfferingEditing rdf:type owl:Class ;
    rdfs:label "Productediting"@en ;                     
    rdfs:subClassOf prov:Activity ;
    rdfs:comment "Product edition in virtuemart"@en ;
.


###########################################################################################
# Taxonomies
###########################################################################################

:manufacturer a skos:Concept ;
    skos:prefLabel "a product manufacturer" ;
    dcterms:description "this user produces a product" ;  
.
###### SHOPPER GROUPS #################
:shopperGroups a skos:ConceptScheme ;
    dcterms:title "Shopper groups" ;
.
<?php foreach ($this->shopperGroups as $shopperGroup):?>
:shoppergroup_<?=$shopperGroup->virtuemart_shoppergroup_id?> a skos:Concept ;
    skos:prefLabel "<?=$shopperGroup->shopper_group_name?>" ;
    dcterms:description "<?=$shopperGroup->shopper_group_desc?>" ;  
    skos:inScheme :shopperGroups ;
.
<?php endforeach?>

###### PRODUCT CATEGORIES ###############
:productCategories a skos:ConceptScheme;
    dcterms:title "Product categories" ;
.
<?php foreach ($this->productCategories as $productCategory):
    // shortcuts
    $c =$productCategory;
    $cid = $c->virtuemart_category_id;
?>
:productCategory_<?=$cid?> a skos:Concept ;
    skos:prefLabel <?=ApiHelper::_T($c->category_name)?> ;
    skos:inScheme :productCategories ;
<?php if(!empty($c->parents)):foreach($c->parents as $parent):if($parent->virtuemart_category_id!=$cid):?>
    skos:broader :productCategory_<?=$parent->virtuemart_category_id?> ;
<?php endif;endforeach;endif?>
<?php if(!empty($c->children)):foreach($c->children as $child):?>
    skos:narrow :productCategory_<?=$child->virtuemart_category_id?> ;
<?php endforeach;endif?>
.
<?php if($c->category_description && $c->category_description!=$c->category_name):?>
:productCategory_<?=$cid?> pm:hasRichDescription :productCategory_<?=$cid?>_desc .
:productCategory_<?=$cid?>_desc a pm:RichDescription ;
    dcterms:format "text/html" ;
    pm:hasRichDescriptionValue <?=ApiHelper::_T($c->category_description)?> ;
.
<?php endif?>
<?php foreach ($c->show_images as $image):?>
:productCategory_<?=$cid?> <?=$this->getDepictionMetadata($image)?> .
<?php endforeach ?>

<?php endforeach ?>
<?php 
if(JDEBUG){
    echo "#------------------ START DEBUGGING INFO -------------------------\n#";
    echo preg_replace("/\n/", "\n#", ApiHelper::debugInfo($this->shopperGroups));
    echo preg_replace("/\n/", "\n#", ApiHelper::debugInfo($this->productCategories));
    echo "\n#------------------ END DEBUGGING INFO -------------------------\n";
}
?>